package com.wanho.qz103.hrsaas.sys.dao.impl;

import com.wanho.qz103.hrsaas.commons.annontations.Repository;
import com.wanho.qz103.hrsaas.commons.dao.impl.BaseDAOImpl;
import com.wanho.qz103.hrsaas.commons.exception.DAOException;
import com.wanho.qz103.hrsaas.sys.dao.DepartmentDAO;
import com.wanho.qz103.hrsaas.sys.pojos.Department;

import java.util.List;

@Repository
public class DepartmentDAOImpl extends BaseDAOImpl<Department> implements DepartmentDAO {

    /**
     * 树形表：只做了查询所有 无需分页查询
     * @return
     */
    @Override
    protected String selectAllSQL() {
        return "SELECT id,code,name,introduce,manager,pid FROM sys_department";
    }

    @Override
    protected String deleteSQL() {
        return "delete from sys_department where id = ? ";
    }

    @Override
    protected String insertSQL() {
        return "insert into sys_department(id,code,name,introduce,manager,pid) values(#{id},#{code},#{name},#{introduce},#{manager},#{pid})";
    }

    @Override
    protected String updateSQL() {
        return "update sys_department set code=#{code},name=#{name},introduce=#{introduce},manager=#{manager} where id=#{id}";
    }

    @Override
    protected String selectByIdSQL() {
        return "SELECT id,code,name,introduce,manager,pid FROM sys_department where id=#{id}";
    }
}
